<?php

class EmailTaskListAction extends CommonAction {

    

    public function _initialize() {

        parent::_initialize();
    }
    
    public function index() {
        $map = array();
        import("@.ORG.Util.Page");       //导入分页类
        $model = M('Email_task_list');

        $count = $model->count();    //计算总数

        $p = new Page($count, 50);
        $rows = $model
                ->join('email_template on email_template.template_id = email_task_list.template_id')
                ->join('email_task on email_task.task_id = email_task_list.task_id')
                ->field('email_task_list.*,email_template.title as template_title,email_task.title as task_title,email_limit')
                ->limit($p->firstRow . ',' . $p->listRows)
                ->order('task_id desc')
                ->select();
        $page = $p->show();            //分页的导航条的输出变量

        $this->assign("page", $page);
        $this->assign("rows", $rows); //数据循环变量

        $this->display('index');
    }
}
